package com.aiyige.share.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.aiyige.R;
import com.aiyige.share.model.ShareThirdPlatformItem;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.LinkedList;

import butterknife.BindView;
import butterknife.ButterKnife;

public class AppShareThirdPlatformAdapter extends BaseQuickAdapter<ShareThirdPlatformItem, AppShareThirdPlatformAdapter.ViewHolder> {
    public AppShareThirdPlatformAdapter() {
        super(R.layout.app_share_third_platform_item, new LinkedList<ShareThirdPlatformItem>());
    }

    @Override
    protected void convert(ViewHolder helper, ShareThirdPlatformItem item) {
        helper.bindData(item);
    }

    public class ViewHolder extends BaseViewHolder {
        @BindView(R.id.shareIv)
        ImageView shareIv;
        @BindView(R.id.shareTv)
        TextView shareTv;

        public ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }

        public void bindData(ShareThirdPlatformItem item) {
            switch (item.getType()) {
                case ShareThirdPlatformItem.TYPE_WEIXIN:
                    shareIv.setImageResource(R.drawable.share_wechat);
                    shareTv.setText(R.string.weixin_name);
                    break;
                case ShareThirdPlatformItem.TYPE_FRIEND:
                    shareIv.setImageResource(R.drawable.share_friends);
                    shareTv.setText(R.string.friend);
                    break;
                case ShareThirdPlatformItem.TYPE_QQ:
                    shareIv.setImageResource(R.drawable.share_qq);
                    shareTv.setText(R.string.qq);
                    break;
                case ShareThirdPlatformItem.TYPE_WEIBO:
                    shareIv.setImageResource(R.drawable.share_blog);
                    shareTv.setText(R.string.weibo);
                    break;
                case ShareThirdPlatformItem.TYPE_LINK:
                    shareIv.setImageResource(R.drawable.share_link);
                    shareTv.setText(R.string.copy_link);
                    break;
                case ShareThirdPlatformItem.TYPE_REPORT:
                    shareIv.setImageResource(R.drawable.report);
                    shareTv.setText(R.string.report);
                    break;
            }

        }
    }

}
